﻿using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace Service
{
    public class CategoryService
    {
        Model1 db = new Model1();

        //所有栏目
        public List<CMS_Category> Categorys
        {
            get
            {
                var categorys = HttpContext.Current.Cache["categorys"] as List<CMS_Category>;
                if (categorys==null)
                {
                    categorys = db.CMS_Category.ToList();
                    HttpContext.Current.Cache["categorys"] = categorys;
                }
                return categorys;
            }
            
        }

        public void Dispose()
        {
            db.Dispose();
        }

    }
}
